using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using static AllCoontrol;

public class item_collector : MonoBehaviour
{
    private int cherries = GameManager.instance.score;

    [SerializeField] public Text cherriesText;
    [SerializeField] private AudioSource collectSoundEffect;

    public void OnTriggerEnter2D(Collider2D collision)
    {

        if (collision.gameObject.CompareTag("Cherry"))
        {
            Destroy(collision.gameObject);
            cherries++;
            Console.WriteLine(cherriesText);
            cherriesText.text = "Cherries:" + cherries;
            collectSoundEffect.Play();
            GameManager.instance.score = cherries;
        }
    }
}
